summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-08-26 00:02:47 +0200
committerGitHub <noreply@github.com>2023-08-26 00:02:47 +0200
commitd8c8fbe41f626448e99c0a45b1ba282fe6137250 (patch)
tree84de8718d44e47e65fa8e2e5d3f905636f641988
parentssl: tolerate handshake without hostname set (#11328) (diff)
parentyuzu/main: Ensure NCAs are registered in content provider when launching from CLI (diff)
downloadyuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.gz
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.bz2
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.lz
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.xz
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.zst
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.zip
-rw-r--r--src/yuzu/main.cpp38
-rw-r--r--src/yuzu/main.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index a9d035f3d..8e933af64 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1811,6 +1811,43 @@ bool GMainWindow::SelectAndSetCurrentUser(
return true;
}
+void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) {
+ // Ensure all NCAs are registered before launching the game
+ const auto file = vfs->OpenFile(filepath, FileSys::Mode::Read);
+ if (!file) {
+ return;
+ }
+
+ auto loader = Loader::GetLoader(*system, file);
+ if (!loader) {
+ return;
+ }
+
+ const auto file_type = loader->GetFileType();
+ if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) {
+ return;
+ }
+
+ u64 program_id = 0;
+ const auto res2 = loader->ReadProgramId(program_id);
+ if (res2 == Loader::ResultStatus::Success && file_type == Loader::FileType::NCA) {
+ provider->AddEntry(FileSys::TitleType::Application,
+ FileSys::GetCRTypeFromNCAType(FileSys::NCA{file}.GetType()), program_id,
+ file);
+ } else if (res2 == Loader::ResultStatus::Success &&
+ (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP)) {
+ const auto nsp = file_type == Loader::FileType::NSP
+ ? std::make_shared<FileSys::NSP>(file)
+ : FileSys::XCI{file}.GetSecurePartitionNSP();
+ for (const auto& title : nsp->GetNCAs()) {
+ for (const auto& entry : title.second) {
+ provider->AddEntry(entry.first.first, entry.first.second, title.first,
+ entry.second->GetBaseFile());
+ }
+ }
+ }
+}
+
void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
StartGameType type) {
LOG_INFO(Frontend, "yuzu starting...");
@@ -1825,6 +1862,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
last_filename_booted = filename;
+ ConfigureFilesystemProvider(filename.toStdString());
const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 2cfb96257..1b7055122 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -399,6 +399,7 @@ private:
void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
bool CheckDarkMode();
bool CheckSystemArchiveDecryption();
+ void ConfigureFilesystemProvider(const std::string& filepath);
QString GetTasStateDescription() const;
bool CreateShortcut(const std::string& shortcut_path, const std::string& title,